package com.top.mall.main.income

import com.blankj.utilcode.util.BarUtils
import com.module.lemlin.owner.OwnerViewModeFragment
import com.top.mall.R
import com.top.mall.jetpack.vm.IncomeViewModel
import kotlinx.android.synthetic.main.fragment_main_income.*


class IncomeFragment : OwnerViewModeFragment<IncomeViewModel>() {

    companion object {
        fun newInstance(): IncomeFragment {
            return IncomeFragment()
        }
    }

    override val layoutResId: Int
        get() = R.layout.fragment_main_income

    override fun viewModel(): IncomeViewModel {
        return createViewModel()
    }

    override fun stateBar(): StatusBar {
        return StatusBar(view = flIncomeBar)
    }

    override fun initView() {
        //为Toolbar添加状态栏高度
        BarUtils.addMarginTopEqualStatusBarHeight(flIncomeBar)


        //我的代金券
        ivIncomeCouponCash.setOnClickListener {
            CouponCashActivity.open(requireActivity())
        }

        //我的优惠券
        ivIncomeCouponDiscount.setOnClickListener {
            CouponDiscountActivity.open(requireActivity())
        }

        //领券中心
        ivIncomeCouponCenter.setOnClickListener {
            CouponCenterActivity.open(requireActivity())
        }

        //新人大礼包
        ivIncomeNewUser.setOnClickListener {
            CouponNewUserActivity.open(requireActivity())
        }

        //邀请好友
        ivIncomeInvitation.setOnClickListener {
            CouponInviteActivity.open(requireActivity())
        }

    }

    override fun initData() {

    }

//    override fun onTouch(v: View?, event: MotionEvent?): Boolean {
//        when (event?.action) {
//            MotionEvent.ACTION_DOWN -> v?.animate()?.scaleX(0.95f)?.scaleY(0.95f)
//                ?.setDuration(50)?.start()
//            MotionEvent.ACTION_UP -> {
//                v?.animate()?.scaleX(1f)?.scaleY(1f)?.setDuration(50)?.start()
//            }
//        }
//        return false
//    }


}